/**
 * 限制结束时间不能小于结束时间
 */
export default {
  data () {
    return {
      pickerOptionsStart:{},
      pickerOptionsEnd: {},
    }
  },
  methods: {

    changeStart(startTime,endTime) { // 限制开始时间
      if (endTime != '') {
        if (endTime <= startTime) {
          this.$message.warning('结束时间必须大于开始时间！');
        }
      }
      this.pickerOptionsEnd = Object.assign({}, this.pickerOptionsEnd, {
        disabledDate: (time) => {
          if (startTime) {
            return time.getTime() < new Date(startTime);
          }
        },
      });
    },
    

    changeEnd(startTime,endTime) { // 限制结束时间
      if (startTime != '') {
        if (endTime <= startTime) {
          this.$message.warning('结束时间必须大于开始时间！');
        }
      }
      this.pickerOptionsStart = Object.assign({}, this.pickerOptionsStart, {
        disabledDate: (time) => {
          if (this.phasesForm.endTime) {
            return time.getTime() > new Date(this.phasesForm.endTime);
          }
        },
      });
    },
    
  },
  
}
